package com.example.batch.listen.read;

import com.example.batch.entity.Person;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.ItemReadListener;

@Slf4j
public class PersonItemReadListener implements ItemReadListener<Person> {

    @Override
    public void beforeRead() {
        log.info("读取csv文件之前");
    }

    @Override
    public void afterRead(Person person) {
        log.info("读取csv文件之后:{}", person.toString());
    }

    @SneakyThrows
    @Override
    public void onReadError(Exception e) {
        log.info("读取csv文件异常");
    }
}
